﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PromotionItemUsedReport.ascx.cs" Inherits="CS424_9pts.Administration.Modules.PromotionItemUsedReport" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<div class="section-header">
    <div class="title">
        <img src="Common/ico-sales.png" alt="Promotion Item Report" />    
    </div>
    <div class="options">
    </div>
</div>

<asp:SqlDataSource  ID="SqlDataPromotionItem" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:CarManagementConnectionString %>"
                    SelectCommand="SELECT PromotionDetails.PromotionID, PromotionDetails.Title, PromotionDetails.GiftInfo, PromotionDetails.Description, Promotions.StartDate, Promotions.EndDate FROM Contracts INNER JOIN PromotionDetails ON Contracts.PromotionID = PromotionDetails.PromotionID INNER JOIN Promotions ON Contracts.PromotionID = Promotions.PromotionID AND PromotionDetails.PromotionID = Promotions.PromotionID INNER JOIN PromotionForCarModels ON Promotions.PromotionID = PromotionForCarModels.PromotionID" 
    DeleteCommand="DELETE FROM [Promotion] WHERE [PromotionID] = @PromotionID" 
    InsertCommand="INSERT INTO [Promotion] ([Discount], [HasGift], [StartDate], [EndDate], [Status]) VALUES (@Discount, @HasGift, @StartDate, @EndDate, @Status)" 
    
    UpdateCommand="UPDATE [Promotion] SET [Discount] = @Discount, [HasGift] = @HasGift, [StartDate] = @StartDate, [EndDate] = @EndDate, [Status] = @Status WHERE [PromotionID] = @PromotionID">
    <DeleteParameters>
        <asp:Parameter Name="PromotionID" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="Discount" Type="Double" />
        <asp:Parameter Name="HasGift" Type="Int32" />
        <asp:Parameter Name="StartDate" Type="DateTime" />
        <asp:Parameter Name="EndDate" Type="DateTime" />
        <asp:Parameter Name="Status" Type="Int32" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="Discount" Type="Double" />
        <asp:Parameter Name="HasGift" Type="Int32" />
        <asp:Parameter Name="StartDate" Type="DateTime" />
        <asp:Parameter Name="EndDate" Type="DateTime" />
        <asp:Parameter Name="Status" Type="Int32" />
        <asp:Parameter Name="PromotionID" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>

<asp:GridView ID="gvPromotionItemUsed" runat="server" AllowPaging="True" 
    AllowSorting="True" CellPadding="4" DataSourceID="SqlDataPromotionItem" 
    ForeColor="#333333" GridLines="None" AutoGenerateColumns="False" >
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:BoundField DataField="PromotionID" HeaderText="PromotionID" 
            SortExpression="PromotionID" />
        <asp:BoundField DataField="Title" HeaderText="Title" 
            SortExpression="Title" />
        <asp:BoundField DataField="GiftInfo" HeaderText="GiftInfo" 
            SortExpression="GiftInfo" />
        <asp:BoundField DataField="Description" HeaderText="Description" 
            SortExpression="Description" />
        <asp:BoundField DataField="StartDate" HeaderText="StartDate" 
            SortExpression="StartDate" />
        <asp:BoundField DataField="EndDate" HeaderText="EndDate" 
            SortExpression="EndDate" />
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>